Conversation
Contributor
Author
|
Actually, we have There are currently two different ways to represent bytes, this PR doesn't change that; none of which are friendly to formatting. I will look at merging these two once C++23 is ready, while also making sure that it's pre-allocator safe. For what it's worth, we might want to introduce |
Contributor
|
lgtm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As requested in #2309 (comment), byte-formatters now reside in a standalone namespace.
I have also introduced a stringifier for
errnovalues. The standard hasstrerror()for the corresponding message, but not the name. This provideserrno_name(errno)for this purpose.There's also a convenience helper for things that don't support string-views:
errno_cstr(errno). This is preferred over explicitly doingerrno_name(errno).data()in corresponding locations because this way we can eventually deprecate c-strings from a single location without having to track down who uses printf-style specifiers.Sadly, there is no convenient way to put these into an enum class and have the compiler turn it into a string. There are hopes for this in C++26, see: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2996r13.html